window.onload=function (){
init();
tableInit();
}

/**
 * 初始化登录信息
 */
function init(){
    axios.get("/user/getLoginUser").then(resp =>{
        let info = resp.data;
            $("img").src = info.img;
            $("nameSpan").innerHTML = info.name;
            $("emailSpan").innerHTML = info.email;
    })
}
function tableInit() {
    axios.get("/index/findAll").then(resp=>{
        let info = resp.data;
        let  str = "";
        info.forEach(n=>{
            str += `<tr>
                        <td><a href="/channel.html?id=${n.id}">${n.name}</a></td>
                        <td>${n.info}</td>
                        <td>${n.num}</td>
                    </tr>`
        });
        $("data").innerHTML=str;
    })
}


